<script setup>
import UploadController from './UploadController.vue'
import { ref } from 'vue'

const files = ref([])
const state = ref(false)
const currentFile = ref()
const onChange = event => {
    for (const file of event.target.files) {
        file.State = 0
        files.value.push(file)
    }
}
const open = file => {
    currentFile.value = file
    state.value = true
}
</script>

<template>
    <div>
        <input type="file" multiple @change="onChange" />
        <div v-for="file in files">
            <n-button @click="open(file)">{{ file.name }}</n-button>
        </div>
        <UploadController :file="currentFile" v-model="state" />
    </div>
</template>
